package com.itgaohe.controller;

import com.itgaohe.service.FollowService;
import com.itgaohe.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/follow")
@Tag(name = "粉丝管理", description = "用户相关操作")
public class FollowController {

    @Autowired
    private FollowService followService;

    /**
     * 查询用户是否关注博主
     */
    @Operation(summary = "根据用户id查询用户是否关注博主")
    @GetMapping("/or/not/{userId}")
    public Result not(@PathVariable int userId) {
        Boolean result = followService.searchOrNotFollow (userId) ;
        if (result) {
            return Result.ok(0) ;
        }
        return Result.ok(1) ;

    }

}
